package main

import (
	"fmt"
	"strings"
	"time"
)

func isPalindrome(s string) bool {
	if s == "" || len(s) == 0 {
		return true
	}
	s = strings.ToLower(s)
	start := 0
	end := len(s) - 1
	for start <= end {
		// fmt.Printf("%c,%c,%c\n", s[start], s[end], '0')
		if !(('a' <= s[start] && s[start] <= 'z') || ('0' <= s[start] && s[start] <= '9')) {
			start++
			continue
		}
		if !(('a' <= s[end] && s[end] <= 'z') || ('0' <= s[end] && s[end] <= '9')) {
			end--
			continue
		}
		fmt.Println(start, end)
		if s[start] != s[end] {
			return false
		}

		start++
		end--

	}
	return true
}

func main() {
	start := time.Now()
	s := "0P"
	result := isPalindrome(s)
	cost := time.Since(start)
	fmt.Println("result:", result)
	fmt.Println(cost)

}
